define(['text!service/installation.html', '../service/data/appliancesList'],
	function(viewTemplate, Appliances) {
		return Piece.View.extend({
			id: 'service_installation',
			events: {

				"click #add": "add",
				"click .list-st": "detail",
			},
			render: function() {
				$(this.el).html(viewTemplate);

				Piece.View.prototype.render.call(this);
				return this;
			},
			onShow: function() {
				//write your business logic here :)

				var windowHeight = $(window).height();
				var elTop = $("#appliances").offset().top;
				var elHeight = windowHeight - elTop;

				console.info(elHeight);
				$("#appliances").css({
					"height": elHeight
				});
				new iScroll($("#appliances")[0]);
				this.TempviewlateRender(Appliances);

			},
			//模板页面渲染

			TempviewlateRender: function(data) {

				var listTemplateWiki = _.template($("#appliancesTemp").html(), {
					"rows": data.rows
				});

				$("#appliancesList").append(listTemplateWiki);


				// new iScroll($("#standards"));
			},

			add: function() {
				this.container.navigateForResult('/service/addAppliances', {
					trigger: true
				}, 'service/installation', this.onGotResult);

			},


			detail: function() {
				this.container.navigateForResult('/service/repairDetail', {
					trigger: true
				}, 'service/installation', this.onGotResult);

			}
		}); //view define

	});